<?php
namespace App\Http\Controllers;

use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Services\CommonServices as Common;

class SqltestController extends Controller{
    // 测试MySQL连接
    public function index(Request $request){
        // 获取听见数据
        $number = empty($request->input('number')) ? 15 : $request->input('number');

        $data = DB::table('activity_goods')->select('goods_id')->limit($number)->get();
        $data = Common::object_array($data);

        return ['code'=>200,'msg'=>'请求成功','data'=>$data];
    }
}
